/*
 * iso15693.c
 *
 *  Created on: Aug 22, 2024
 *      Author: 31652
 */

#include "iso15693.h"

ReadBlockCallback __isoi5693ReadBlockListener;
ReadBlocksCallback __isoi5693ReadBlocksListener;
WriteBlockCallback __isoi5693WriteBlockListener;
WriteBlocksCallback __isoi5693WriteBlocksListener;
LockBlockCallback __isoi5693LockBlockListener;


void _15693_set_read_block_listener(ReadBlockCallback listener) {
	if (listener == NULL) {
		return;
	}
	__isoi5693ReadBlockListener = listener;
}

void _15693_set_read_blocks_listener(ReadBlocksCallback listener) {
	if (listener == NULL) {
		return;
	}
	__isoi5693ReadBlocksListener = listener;
}
void _15693_set_write_block_listener(WriteBlockCallback listener) {
	if (listener == NULL) {
		return;
	}
	__isoi5693WriteBlockListener = listener;
}
void _15693_set_write_blocks_listener(WriteBlocksCallback listener) {
	if (listener == NULL) {
		return;
	}
	__isoi5693WriteBlocksListener = listener;
}
void _15693_set_lock_block_listener(LockBlockCallback listener) {
	if (listener == NULL) {
		return;
	}
	__isoi5693LockBlockListener = listener;
}

//////CMD response////////////////////////////

void _15693_on_read_block_resp(uint8_t blockNum, uint8_t* data, uint8_t errCode) {
	if (__isoi5693ReadBlockListener == NULL) {
		return;
	}
	__isoi5693ReadBlockListener(blockNum, data, errCode);
}

void _15693_on_read_blocks_resp(uint8_t beginBlock, uint8_t blocks, uint8_t* data, uint8_t errCode) {
	if (__isoi5693ReadBlocksListener == NULL) {
		return;
	}
	__isoi5693ReadBlocksListener(beginBlock, blocks, data, errCode);
}

void _15693_on_write_block_resp(uint8_t blockNum, uint8_t errCode) {
	if (__isoi5693WriteBlockListener == NULL) {
		return;
	}
	__isoi5693WriteBlockListener(blockNum, errCode);
}
void _15693_on_write_blocks_resp(uint8_t blockNum, uint8_t blocks, uint8_t errCode) {
	if (__isoi5693WriteBlocksListener == NULL) {
		return;
	}
	__isoi5693WriteBlocksListener(blockNum, blocks, errCode);
}

void _15693_on_lock_block_resp(uint8_t blockNum, uint8_t errCode) {
	if (__isoi5693LockBlockListener == NULL) {
		return;
	}
	__isoi5693LockBlockListener(blockNum, errCode);
}







